from EventDefine import event_PRELUDEFINALE_FINALEDONE
from direct.gui.DirectGui import DirectFrame
# animation
from direct.interval.IntervalGlobal import *

class PreludeFinaleFrame(DirectFrame):
    # override it
    def Prelude(self):
        pass

    # override it
    def FinaleAnimation(self):
        return None

    def destroy(self):
        FinaleAnimation = self.FinaleAnimation()
        if FinaleAnimation is not None:
            Sequence(FinaleAnimation,
                     Func(DirectFrame.destroy, self),
                     Func(messenger.send, event_PRELUDEFINALE_FINALEDONE)
                     ).start()
        else: # no finale animation
            DirectFrame.destroy(self)
            messenger.send(event_PRELUDEFINALE_FINALEDONE)
